package fr.afcepf.atod12.projet1.dao.tests;

import java.util.List;

import junit.framework.TestCase;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

import fr.afcepf.atod12.projet1.entities.Patient;
import fr.afcepf.atod12.projet1.facades.IFacadeServices;



@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/springContextAnot.xml"})
@TransactionConfiguration(transactionManager="txManager",defaultRollback=false) 
@Transactional
public class TestFacades extends TestCase{
	
	@Autowired
	@Qualifier("facadeService")
	private IFacadeServices facade;
	
	@Test
	public void testGetPatientByName() {
		List<Patient> listePatient = facade.getServicePersonne().getPatientByName("pa");
		
		for(Patient pers : listePatient){
			System.out.println(pers);
		}
	}
}
